import axios from "axios";
const request = axios.create({
    baseURL: '/api',
    timeout: 5000
})

request.interceptors.request.use(config => {
    config.headers.Authorization = localStorage.getItem('token') ? localStorage.getItem('token') : null
    return config
}, err => {
    return Promise.reject(err)
})

request.interceptors.response.use(res => {
    return res.data
}, err => {
    return Promise.reject(err)
})

export default request